import request from '@/axios'
import type { ListParams, Response } from '@/api/api'

export interface Row {
  id: number
  no: string
  name: string
  deliver_driver_id: string
  warehouse_id: string
  store_ids: string
}

export interface FormData {
  id?: number
  no: string
  name: string
  deliver_driver_id: string
  warehouse_id: string
  store_ids: string
}
// 路线列表
export const getListApi = (data: ListParams): Promise<Response<Row>> => {
  return request.post({ url: '/deliver/line/list', data })
}
// 路线列表新增
export const createApi = (data: Partial<FormData>): Promise<IResponse> => {
  return request.post({ url: '/deliver/line/create', data })
}
// 路线列表编辑
export const modifyApi = (data: Partial<FormData>): Promise<IResponse> => {
  return request.post({ url: '/deliver/line/modify', data })
}
// 路线列表删除
export const delUserApi = (data: { id: string }): Promise<IResponse> => {
  return request.post({ url: '/deliver/line/del', data })
}

// 路线列表详情
export const detailsApi = (data: { id: string }): Promise<IResponse> => {
  return request.post({ url: '/deliver/line/details', data })
}

// 门店删除
export const storeDelApi = (data): Promise<IResponse> => {
  return request.post({ url: '/deliver/line/store_del', data })
}

// 门店添加
export const storeCreateApi = (data: { id: string }): Promise<IResponse> => {
  return request.post({ url: '/deliver/line/store_create', data })
}
